Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: convert to ESM, use Aspect build rules #1307

Merged
merged 9 commits into from
Feb 3, 2023
Merged

Conversation

alexander-fenster
Copy link
Contributor

@alexander-fenster alexander-fenster commented Feb 1, 2023

This PR consists of four commits that are logically unrelated but should go together. It might be easier to review them one by one.

  1. Update baselines (copyright year and minor changes of dependency protos). This one is straightforward.

  2. Change the Bazel stack to use the new Aspect rules for JavaScript and TypeScript. Unfortunately, for TypeScript, I'm currently using my fork of the rules that fixes some issues; I'll try to contribute it upstream but I'm willing to use the fork while this is in progress to unblock this repository.

  3. Make the generator an ESM module. It simplifies working with new dependencies, and make TypeScript emit more predictable code (compared with the one with commonjs requires).

  4. Remove fragile parts that keep breaking. We are getting rid of gts and eslint (for now, until they properly support the new ESM import syntax - I filed bring back gts and/or eslint #1308) and also getting rid of complicated integration tests: they were broken anyway but were reporting pass, which is the worst thing a test can do. I'll need to rethink how to make good integration tests. For now, we still have baseline test and we check that the generated libraries compile properly.

R= @noahdietz for Bazel related fixes (this commit specifically)

R= @sofisl and @bcoe for ESM related fixes (this commit)

@alexander-fenster
Copy link
Contributor Author

@ddelgrosso1 FYI - Ben suggested I add you for the ESM conversion commit (just this one). This is our GAPIC generator and it's going to be an ESM app from now on. The fact that it's built by Bazel greatly complicates things.

Copy link
Contributor

@bcoe bcoe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a couple nits, I think there are some built in Node.js methods you could be using like mkdir with the recursive flag.

package.json Show resolved Hide resolved
typescript/src/util.ts Outdated Show resolved Hide resolved
typescript/test/test-application/test-js.ts Outdated Show resolved Hide resolved
typescript/src/schema/proto.ts Show resolved Hide resolved
if (name.service === serviceName && name.method === methodName) {
exactMatch = config;
for (const name of config.name) {
if (name.service === serviceName && !name.method) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems kind of strange to me that this wouldn't be an if/else, because would it be possible for !name.method and name.method ==== methodName?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, if-else is more logical here. Fixed.

typescript/test/test-application/test-ts.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@noahdietz noahdietz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM for bazel stuff

WORKSPACE Outdated Show resolved Hide resolved
typescript/test/unit-test-runner.ts Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants